<!doctype html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <!-- Apple devices fullscreen -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <!-- Apple devices fullscreen -->
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <!--<link href="__PUBLIC__/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />-->

    <link href="__PUBLIC__/usr/css/main.css" rel="stylesheet" type="text/css">
    <link href="__PUBLIC__/usr/css/page.css" rel="stylesheet" type="text/css">
    <link href="__PUBLIC__/usr/font/css/font-awesome.min.css" rel="stylesheet" />
    <!--[if IE 7]>
    <link rel="stylesheet" href="__PUBLIC__/usr/font/css/font-awesome-ie7.min.css">
    <![endif]-->
    <link href="__PUBLIC__/usr/js/jquery-ui/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
    <link href="__PUBLIC__/usr/js/perfect-scrollbar.min.css" rel="stylesheet" type="text/css"/>
    <style type="text/css">html, body { overflow: visible;}</style>
    <script type="text/javascript" src="__PUBLIC__/usr/js/jquery.js"></script>
    <script type="text/javascript" src="__PUBLIC__/usr/js/jquery-ui/jquery-ui.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/usr/js/layer/layer.js"></script><!-- 弹窗js 参考文档 http://layer.layui.com/-->
    <script type="text/javascript" src="__PUBLIC__/usr/js/admin.js"></script>
    <script type="text/javascript" src="__PUBLIC__/usr/js/jquery.validation.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/usr/js/common.js"></script>
    <script type="text/javascript" src="__PUBLIC__/usr/js/perfect-scrollbar.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/usr/js/jquery.mousewheel.js"></script>
    <script type="text/javascript" src="__PUBLIC__/plugins/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="__PUBLIC__/plugins/ueditor/ueditor.all.min.js"></script>
    <script src="__PUBLIC__/usr/js/myFormValidate.js"></script>
    <script src="__PUBLIC__/usr/js/myAjax2.js"></script>
    <script src="__PUBLIC__/usr/js/global.js"></script>

    <!--<script src="__PUBLIC__/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>-->

    <style type="text/css">
        #winpop {
            width:200px; height:0px;
            border:1px solid #999999; margin:0; padding:1px;
            overflow:hidden; display:none; background:#FFFFFF;
            position: fixed;
            right: 0;
            bottom: 10px;
            z-index: 99
        }
        #winpop .title {
            width:100%; height:20px;
            line-height:20px; background:#0ba4da;
            font-weight:bold; text-align:center;
            font-size:12px;
        }
        #winpop .con {
            width:100%; height:80px;
            line-height:80px; font-weight:bold;
            font-size:12px; color:#FF0000;
            text-decoration:underline; text-align:center
        }
        .close {
            position:absolute; right:4px; top:-1px;
            color:#FFFFFF; cursor:pointer
        }
        .con a{
            display: block;
            margin: 0 auto;
            width: 100px;
            height: 40px;
            line-height: 40px;
            color: #333;
            font-size: 12px;
        }
    </style>
    <div id="winpop">
        <div class="title">您有新的消息
            <span class="close" onclick="tips_pop_down()">X</span></div>
        <div class="con">
            <a href="{:U('Order/index')}">待发货订单(<span id="ready_send"></span>)</a>
            <a href="{:U('Order/return_list')}">待退款订单(<span id="ready_back"></span>)</a>
        </div>
    </div>
    <script type="text/javascript">
        document.getElementById('winpop').style.height='0px';
        function tips_pop_up(){
            var MsgPop=document.getElementById("winpop");
            var popH=parseInt(MsgPop.style.height);
            if (popH<=4){
            MsgPop.style.display="block";
            show=setInterval("changeH('up')",2);
            }
        }
        function tips_pop_down(){
            hide=setInterval("changeH('down')",2);
        }
        function changeH(str) {
            var MsgPop=document.getElementById("winpop");
            var popH=parseInt(MsgPop.style.height);
            if(str=="up"){
                if (popH<=100){
                    MsgPop.style.height=(popH+4).toString()+"px";
                }
                else{
                    clearInterval(show);
                }
            }
            if(str=="down"){
                if (popH>=4){
                    MsgPop.style.height=(popH-4).toString()+"px";
                }
                else{
                    clearInterval(hide);
                    MsgPop.style.display="none";
                }
            }
        }


        window.setInterval(function(){
            $.ajax({
                type:'POST',
                url:"{:U('Index/ajax_msg')}",
                data: {},
                success:function(msg){
                    if(msg.ready_back !== "0"||msg.ready_send !=="0") {
                        $('#ready_send').text(msg.ready_send);
                        $('#ready_back').text(msg.ready_back);
                        tips_pop_up();
                    }
                },
            })
        },10000);


    </script>


    <script type="text/javascript">
        function delfunc(obj){
            layer.confirm('确认删除？', {
                        btn: ['确定','取消'] //按钮
                    }, function(){
                        // 确定
                        $.ajax({
                            type : 'post',
                            url : $(obj).attr('data-url'),
                            data : {act:'del',del_id:$(obj).attr('data-id')},
                            dataType : 'json',
                            success : function(data){
                                layer.closeAll();
                                if(data==1){
                                    layer.msg('操作成功', {icon: 1});
                                    $(obj).parent().parent().parent().remove();
                                }else{
                                    layer.msg(data, {icon: 2,time: 2000});
                                }
                            }
                        })
                    }, function(index){
                        layer.close(index);
                        return false;// 取消
                    }
            );
        }

        function selectAll(name,obj){
            $('input[name*='+name+']').prop('checked', $(obj).checked);
        }

        function get_help(obj){
            layer.open({
                type: 2,
                title: '帮助手册',
                shadeClose: true,
                shade: 0.3,
                area: ['70%', '80%'],
                content: $(obj).attr('data-url'),
            });
        }

        function delAll(obj,name){
            var a = [];
            $('input[name*='+name+']').each(function(i,o){
                if($(o).is(':checked')){
                    a.push($(o).val());
                }
            })
            if(a.length == 0){
                layer.alert('请选择删除项', {icon: 2});
                return;
            }
            layer.confirm('确认删除？', {btn: ['确定','取消'] }, function(){
                        $.ajax({
                            type : 'get',
                            url : $(obj).attr('data-url'),
                            data : {act:'del',del_id:a},
                            dataType : 'json',
                            success : function(data){
                                layer.closeAll();
                                if(data == 1){
                                    layer.msg('操作成功', {icon: 1});
                                    $('input[name*='+name+']').each(function(i,o){
                                        if($(o).is(':checked')){
                                            $(o).parent().parent().remove();
                                        }
                                    })
                                }else{
                                    layer.msg(data, {icon: 2,time: 2000});
                                }
                            }
                        })
                    }, function(index){
                        layer.close(index);
                        return false;// 取消
                    }
            );
        }

        $(function(){
            $("[data-type='number']").keyup(function(){
                if(isNaN($(this).val())){
                    $(this).val($(this).val().replace(/\D/g,''))
                }
            });

            $("#check_all").click(function(){
                $("input[class='check_list']").prop('checked', $(this).prop("checked"));
            });
        });
    </script>

</head>